﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ShoppingCart.aspx.cs" Inherits="ShoppingCartWEB.ShoppingCart" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id ="TitleCart">
        <p>My Cart</p>
<asp:Label runat="server" ID="lblNote"></asp:Label>
</div>

<div id="ShoppingCart">
        <asp:Repeater ID="RepShoppingCart" runat="server" 
                onitemcommand="RepShoppingCart_ItemCommand" 
                onitemdatabound="RepShoppingCart_ItemDataBound" 
                ondatabinding="RepShoppingCart_DataBinding"
                EnableViewState = "true">
        <HeaderTemplate>
            <table border="1" cellpadding="5" cellspacing="1" style="border-collapse:collapse; background-color:#F6F6F6; border-collapse:collapse" width="100%">    
                <tr>
                    <th>STT</th>
                    <th>Image</th>
                    <th>Product Name</th>
                    <th>Price</th>
                    <th>Quantity</th>
                    <th>Amount</th>
                    <th></th>

                    
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td width="20px"><asp:Label runat="server" ID="lblSTT" /></td>
                <td width="200px" align="center"><asp:Image ID="imgProduct" Width="100px" Height="100px" runat="server" /></td>
                <td width="200px" align="center"><asp:Label runat="server" ID="lblProductName"/></td>
                <td width="80px" align="center"><asp:Label runat="server" ID="lblPrice"/></td>
                <td width="70px" align="center"><asp:TextBox runat="server" Width="50px" ID="txtNumber"/></td>
                <td width ="100px" align="right"><span id = "money"><asp:Label ID="lblMoney" runat="server" Width="60px"/></span></td>
                <td width ="100px" align="center"><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/deleteItem.png" CommandName="DeleteItem" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"Key.ProductID")%>'/>
                <asp:HiddenField ID="hndProductID" runat="server" Value='<%# DataBinder.Eval(Container.DataItem,"Key.ProductID")%>' />
                </td>
            </tr>
            
        </ItemTemplate>
         <AlternatingItemTemplate>
            <tr bgcolor="#e8e8e8">

                <td width="20px"><asp:Label runat="server" ID="lblSTT" /></td>
                <td width="200px" align="center"><asp:Image ID="imgProduct" Width="100px" Height="100px" runat="server" /></td>
                <td width="200px" align="center"><asp:Label runat="server" ID="lblProductName" /></td>
                <td width="80px" align="center"><asp:Label runat="server" ID="lblPrice"/></td>
                <td width="70px" align="center"><asp:TextBox ID="txtNumber" runat="server" Width="50px"/></td>
                
                <span id="money"><td width ="100px" align="right"><asp:Label ID="lblMoney" runat="server" Width="60px"/></td></span>
                <td width ="100px" align="center"><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/deleteItem.png" CommandName="DeleteItem" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"Key.ProductID")%>'/>
                <asp:HiddenField ID="hndProductID" runat="server" Value='<%# DataBinder.Eval(Container.DataItem,"Key.ProductID")%>' />
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
            <tr style="background-color:#FFD39B; border-color:#FFD39B">
                <td colspan="4">
                    <asp:Button ID="Button1" runat="server" Text="Continue" CommandName="ShoppingCartContinue"  />
                    <asp:Button ID="Button2" runat="server" Text="Update Shopping Cart" CommandName="UpdateShoppingCart" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"Key.ProductID")%>'/>
                </td>
                <td colspan="3" align="right" style="font-weight:bold; font-size:14px">
                    Subtotal : 
                    <span style="color:Red; margin:5px"><asp:Label ID="lblTongTien" runat="server" Width="100px" Text ="10,100,100"/></span>
                </td>
            </tr>
            </table>
        </FooterTemplate>
        </asp:Repeater>
      </div> <!--End ShoppingCart -->
      <div id="Purchase">
        <asp:Button runat ="server" ID ="btnPurchase" Text="Purchase" 
              onclick="btnPurchase_Click"/>
      </div>
</asp:Content>
